package com.lzcu.maoyan.mapreduce.mapreduce.unit;

import org.apache.hadoop.mapreduce.lib.db.DBWritable;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

/**
 * @author WangLiang
 * @date `2024/4/27`
 */
public class MovieLeadingActorWritable implements DBWritable {
    /** 查询到的电影名 */
    private String sourceMovieName;
    /** 最大票房 */
    private long maxTotal;
    /** 查询到的主演 */
    private String sourceLeadingActor;
    /** 处理后的主演 */
    private String leadingActor;
    /** 处理后的票房 */
    private long boxOfficeTotal;
    /** 处理后的电影名 */
    private String movieName;
    private int movieCount;
    @Override
    public void write(PreparedStatement statement) throws SQLException {
        statement.setString(1, this.leadingActor);
        statement.setLong(2, this.boxOfficeTotal);
        statement.setString(3, this.movieName);
        statement.setInt(4, this.movieCount);
    }
    @Override
    public void readFields(ResultSet resultSet) throws SQLException {
        this.sourceMovieName = resultSet.getString("MOVIE_NAME");
        this.maxTotal = resultSet.getLong("MAX_TOTAL_SESSIONS");
        this.sourceLeadingActor = resultSet.getString("ACTTHELEADINGROLE");
    }

    public String getSourceMovieName() {
        return sourceMovieName;
    }

    public void setSourceMovieName(String sourceMovieName) {
        this.sourceMovieName = sourceMovieName;
    }

    public long getMaxTotal() {
        return maxTotal;
    }

    public void setMaxTotal(long maxTotal) {
        this.maxTotal = maxTotal;
    }

    public String getSourceLeadingActor() {
        return sourceLeadingActor;
    }

    public void setSourceLeadingActor(String sourceLeadingActor) {
        this.sourceLeadingActor = sourceLeadingActor;
    }

    public String getLeadingActor() {
        return leadingActor;
    }

    public void setLeadingActor(String leadingActor) {
        this.leadingActor = leadingActor;
    }

    public long getBoxOfficeTotal() {
        return boxOfficeTotal;
    }

    public void setBoxOfficeTotal(long boxOfficeTotal) {
        this.boxOfficeTotal = boxOfficeTotal;
    }

    public String getMovieName() {
        return movieName;
    }

    public void setMovieName(String movieName) {
        this.movieName = movieName;
    }

    public int getMovieCount() {
        return movieCount;
    }

    public void setMovieCount(int movieCount) {
        this.movieCount = movieCount;
    }
}
